<template>
  <div id="footerContainer">
    <div :class="{active: $route.path === '/msite'}" @click="toRouter('/msite')" class="guideItem">
      <i class="iconfont iconshengdantubiao-16"></i>
      <span>首页</span>
    </div>
    <div :class="{active: $route.path === '/search'}" @click="toRouter('/search')" class="guideItem">
      <i class="iconfont iconsousuo"></i>
      <span>搜索</span>
    </div>
    <div :class="{active: $route.path === '/order'}" @click="toRouter('/order')" class="guideItem">
      <i class="iconfont iconbook"></i>
      <span>订单</span>
    </div>
    <div :class="{active: $route.path === '/profile'}" @click="toRouter('/profile')" class="guideItem">
      <i class="iconfont iconshengdantubiao-02"></i>
      <span>我的</span>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    toRouter(path) {
      // 编程式导航 $router
      // if(this.$route.path !== path) {
      //   this.$router.replace(path)
      // }
      this.$route.path !== path && this.$router.replace(path)
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '../../common/stylus/mixins.styl';
#footerContainer
  display flex
  top-border-1px(#eee)
  position fixed
  left 0
  right 0
  bottom 0
  box-sizing border-box
  background-color #fff

  .guideItem
    display flex
    width 25%
    height 50px
    text-align center
    flex-direction column
    &.active
      color $green
    .iconfont
      font-size 22px
      line-height 30px
</style>